package com.jboost.common.exception;

import com.alibaba.fastjson.JSONObject;
import com.jboost.common.constant.enums.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class JBoostException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    //响应码枚举类
    private ResultCode resultCode;
    private Object data;

    public JBoostException(ResultCode resultCode) {
        super(resultCode.getMsg());
        this.resultCode = resultCode;
    }

    public JBoostException(String message) {
        super(message);
    }

    public JBoostException(ResultCode resultCode, String message) {
        super(message);
        this.resultCode = resultCode;
    }
    public JBoostException(ResultCode resultCode, String message,Object data) {
        super(message);
        this.resultCode = resultCode;
        if(null!=message){
            this.resultCode.setMsg(message);
        }
        this.data = data;
    }

    public JBoostException(Throwable cause) {
        super(cause);
    }

    public JBoostException(String message, Throwable cause) {
        super(message, cause);
    }
}
